package array.easy;

import java.util.HashSet;

/**
 * @author wangtianqi
 * 剑指 Offer 03. 数组中重复的数字
 */
public class findRepeatNumber {
    public static int MyCode(int[] nums) {
        HashSet<Integer> set = new HashSet<>(nums.length);
        for (int i = 0; i < nums.length; i++) {
            if (!set.add(nums[i])) {
                return nums[i];
            }
        }
        return 0;
    }
}
